/*
 *
 * *******************************************************************
 *   @项目名称: BHex Android
 *   @文件名称: NetWorkApiManager.java
 *   @Date: 11/29/18 3:21 PM
 *   @Author: chenjun
 *   @Copyright（C）: 2018 BlueHelix Inc.   All rights reserved.
 *   注意：本内容仅限于内部传阅，禁止外泄以及用于其他的商业目的.
 *  *******************************************************************
 *
 */

package io.bhex.sdk.data_manager;

import io.bhex.sdk.socket.BHNetWorkController;

import static io.bhex.sdk.Urls.SOCKET_QUOTE;
import static io.bhex.sdk.Urls.SOCKET_TRADE;

public class NetWorkApiManager {

    public static BHNetWorkController getQuoteInstance(){
        if(mQuoteClient == null) {
            mQuoteClient = new BHNetWorkController(SOCKET_QUOTE, false);
            mQuoteUrl = SOCKET_QUOTE;
        }
        return mQuoteClient;
    }

    public static void releaseQuoteInstance(){
        if(mQuoteClient != null) {
            mQuoteClient.release();
            mQuoteClient = null;
        }
    }

    public static BHNetWorkController getTradeInstance(){
        if(mTradeClient == null) {
            mTradeClient = new BHNetWorkController(SOCKET_TRADE, true);
            mTradeUrl = SOCKET_TRADE;
            TradeDataManager.GetInstance();
        }
        return mTradeClient;
    }

    public static void releaseTradeInstance(){
        if(mTradeClient != null) {
            mTradeClient.release();
            mTradeClient = null;
        }
    }

    public static void subAllTradeSocket(){

    }

    private static BHNetWorkController mQuoteClient;
    private static String  mQuoteUrl;

    private static BHNetWorkController mTradeClient;
    private static String  mTradeUrl;


}
